<template>
    <el-table
    :data="tableData"
    style="width:100%"
    :row-class-name="tableRowClassName">
    <el-table-column
        prop="ID"
        lable="用户ID">
    </el-table-column>
    <el-table-column
        prop="name"
        lable="用户名">
    </el-table-column>
    <el-table-column
        prop="phone"
        lable="电话">
    </el-table-column>
    <el-table-column
        prop="state"
        lable="用户状态">
    </el-table-column>
    <el-table-column
        prop="email"
        lable="电子邮件">
    </el-table-column>
    </el-table>
</template>
<style>
   .el-table .warning-row{
    background: oldlace;
   }

   .el-table .success-row{
    background: #f0f9eb;
   }
   </style>
 <script>
  export default{
    methods:
    {
        tableRowName({row,rowIndex})
        {
            if(rowIndex===1)
            {
                return 'warning-row';
            }
            else if(rowIndex===5){
                return 'success-row';
                
            }
            return '';
        }
    },
    data(){
        return{
            tableData:[{
            ID:'1001',
            name:'张三',
            phone:'18709789240',
            state:'1',
            email:'2944225891@qq.com'
            }]
        }
    }
  }
 </script>
   
